<article class="" id="post-">
<header class="entry-header">
<h1 class="entry-title">.outerHeight()</h1>
<div class="entry-meta">
						所属分类：<span class="category"><a href="/category/css/">CSS</a></span><span class="category-divider"> | </span><span class="category"><a href="/category/dimensions/">尺寸</a></span><span class="category-divider"> | </span><span class="category"><a href="/category/manipulation/">DOM 操作</a> &gt; <a href="/category/manipulation/style-properties/">CSS 属性</a></span>
<span class="pull-right">英文文档：<a href="https://api.jquery123.com/outerHeight/" target="_blank">.outerHeight()</a></span>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<!-- .entry-header -->
<div class="entry-content">
<article class="entry method" id="outerHeight1"><h2 class="section-title">
<span class="name">.outerHeight(  [includeMargin ] )</span><span class="returns">返回: <a href="/Types/#Integer">Integer</a></span>
</h2>
<div class="entry-wrapper">
<p class="desc"><strong>描述: </strong>获取元素集合中第一个元素的当前计算高度值,包括padding，border和选择性的margin。返回一个整数（不包含“px”）表示的值
			 ，或如果在一个空集合上调用该方法，则会返回 null。</p>
<ul class="signatures"><li class="signature" id="outerHeight-includeMargin">
<h4 class="name">
<span class="version-details">添加的版本: <a href="/category/version/1.2.6/">1.2.6</a></span>.outerHeight(  [includeMargin ] )</h4>
<ul><li>
<div><strong>includeMargin</strong></div>
<div>类型: <a href="/Types/#Boolean">Boolean</a>
</div>
<div>一个布尔值，表明是否在计算时包含元素的margin值。</div>
</li></ul>
</li></ul>
<div class="longdesc" id="entry-longdesc">
<p>在<code>.outerHeight()</code>计算中总是包含padding-top ,padding-bottom 和 border-top，border-bottom ；如果<code>includeMargin</code>参数是<code>true</code>，那么margin (top 和 bottom)也会被包含。</p>
<p>这个方法不适用于<code>window</code> 和 <code>document</code>对象，可以使用<code><a href="/height">.height()</a></code>代替。 </p>
<p class="image">
<img src="/resources/0042_04_03.png"/>
</p>
</div>
<section class="entry-examples" id="entry-examples"><header><h2 class="underline">例子:</h2></header><div class="entry-example" id="example-0">
<h4><span class="desc">获取一个段落的outerHeight。
			
			</span></h4>
<div class="syntaxhighlighter xml ">
<table>
<tbody>
<tr>
<td class="gutter">
<div class="line n1">1</div>
<div class="line n2">2</div>
<div class="line n3">3</div>
<div class="line n4">4</div>
<div class="line n5">5</div>
<div class="line n6">6</div>
<div class="line n7">7</div>
<div class="line n8">8</div>
<div class="line n9">9</div>
<div class="line n10">10</div>
<div class="line n11">11</div>
<div class="line n12">12</div>
<div class="line n13">13</div>
</td>
<td class="code">
<pre><div class="container"><div class="line"><code><span class="doctype">&lt;!DOCTYPE html&gt;</span></code></div></div><div class="container"><div class="line"><code><span class="tag">&lt;<span class="title">html</span>&gt;</span></code></div></div><div class="container"><div class="line"><code><span class="tag">&lt;<span class="title">head</span>&gt;</span></code></div></div><div class="container"><div class="line"><code>  <span class="tag">&lt;<span class="title">style</span>&gt;</span><span class="css"><span class="tag">p</span> <span class="rules">{ <span class="rule"><span class="attribute">margin</span>:<span class="value"><span class="number">10</span>px;</span></span><span class="rule"><span class="attribute">padding</span>:<span class="value"><span class="number">5</span>px;</span></span><span class="rule"><span class="attribute">border</span>:<span class="value"><span class="number">2</span>px solid <span class="hexcolor">#666</span>;</span></span> <span class="rule">}</span></span> </span><span class="tag">&lt;/<span class="title">style</span>&gt;</span></code></div></div><div class="container"><div class="line"><code>  <span class="tag">&lt;<span class="title">script</span> <span class="attribute">src</span>=<span class="value">"https://code.jquery.com/jquery-latest.js"</span>&gt;</span><span class="javascript"></span><span class="tag">&lt;/<span class="title">script</span>&gt;</span></code></div></div><div class="container"><div class="line"><code><span class="tag">&lt;/<span class="title">head</span>&gt;</span></code></div></div><div class="container"><div class="line"><code><span class="tag">&lt;<span class="title">body</span>&gt;</span></code></div></div><div class="container"><div class="line"><code>  <span class="tag">&lt;<span class="title">p</span>&gt;</span>Hello<span class="tag">&lt;/<span class="title">p</span>&gt;</span><span class="tag">&lt;<span class="title">p</span>&gt;</span><span class="tag">&lt;/<span class="title">p</span>&gt;</span></code></div></div><div class="container"><div class="line"><code><span class="tag">&lt;<span class="title">script</span>&gt;</span><span class="javascript"><span class="keyword">var</span> p = $(<span class="string">"p:first"</span>);</span></code></div></div><div class="container"><div class="line"><code>$(<span class="string">"p:last"</span>).text( <span class="string">"outerHeight:"</span> + p.outerHeight() + <span class="string">" , outerHeight(true):"</span> + p.outerHeight(<span class="literal">true</span>) );<span class="tag">&lt;/<span class="title">script</span>&gt;</span></code></div></div><div class="container"><div class="line"><code> </code></div></div><div class="container"><div class="line"><code><span class="tag">&lt;/<span class="title">body</span>&gt;</span></code></div></div><div class="container"><div class="line"><code><span class="tag">&lt;/<span class="title">html</span>&gt;</span></code></div></div></pre>
</td>
</tr>
</tbody>
</table>
</div>
<h4>Demo:</h4>
<div class="demo code-demo"></div>
</div></section>
</div></article> </div>
</article>